import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;


public class Strategy {

	/*Artrubutes*/
	private int NumOdd,NumEven;
	private ArrayList<Integer> numbersEliminates;
	private ArrayList<Integer> numbersFavors;
	private boolean isDouble;
	
	/**
	 * Constructor
	 */
	public Strategy() {
		this.NumOdd = -1;
		this.NumEven = -1;
		this.isDouble = true;
		this.numbersEliminates = new ArrayList<Integer>();
		this.numbersFavors = new ArrayList<Integer>();
	}
	
	
	@Override
	public String toString(){
		String s ;
		s = "----- Strategies use in this simulation ------";
		s += "\nNumber of Odd: "+ NumOdd;
		s += "\nNumber of Even: "+ NumEven;
		String d = ((this.isDouble)?"Yes":"No");
		s += "\nDouble number: "+ d;
		s += "\nNumbers to eliminated: " ;
		if (this.numbersEliminates.size() > 0){
			s += getEliminateNum()  ;
		}else{
			s += "EMPTY";
		}
		s += "\nNumbers favor: " ;
		if (this.numbersFavors.size() >0){
			s += getFavorsNum();
		}else{
			s += "EMPTY";
		}
		
		return s +"\n";
	}
	
	/**
	 * Get all eliminated numbers
	 * @return a String of all eliminate numbers
	 */
	private String getEliminateNum() {
		return getStringNumbers(this.numbersEliminates);
	}
	
	/**
	 * Get all eliminated numbers
	 * @return a String of all eliminate numbers
	 */
	private String getFavorsNum() {
		return getStringNumbers(this.numbersFavors);
	}
	
	/**
	 * Get all numbers in String format
	 * @return all numbers in Text format
	 */
	private String getStringNumbers(ArrayList<Integer> l) {
		String s ;
		s ="";
		Iterator<Integer> ite = l.iterator();
		while (ite.hasNext()) {
			s += " "+ite.next();
		}
		return s;
	}
	
	/**
	 * Show all strategies on console
	 */
	public void showStrategies() {
		System.out.println(this);
	}


	/**
	 * Add a number in eliminated number list
	 * @param num - The number to add
	 */
	public void addNumInEliminatedList(int num){
		if(!this.numbersEliminates.contains(num)){
			this.numbersEliminates.add(num);
			System.out.println(num +" -> add in Eliminated Numbers list.");
		}
	}
	
	/**
	 * Add a number in eliminated number list
	 * @param num - The number to add
	 */
	public void addNumInFavorsList(int num){
		if(!this.numbersFavors.contains(num)){
			this.numbersFavors.add(num);
			System.out.println(num +" -> add in Favors Numbers list.");
		}
	}
	
	/**
	 * Test if the lucky number contains the eliminated number or not
	 * @param lNum - a lucky number
	 * @return - true if contains at least 1 digit
	 */
	public boolean isContainsANum(LuckyNumbers lNum){
		return lNum.isExistDigits(this.getNumbersEliminates());
	}
	
	/**
	 * Test if the eliminated numbers list EMPTY
	 * @return
	 */
	public boolean isEliminatedNumEmpty(){
		return this.numbersEliminates.size() < 0;
	}
	

	/**
	 * Test if the favor numbers list EMPTY
	 * @return
	 */
	public boolean isFavorNumEmpty(){
		return this.numbersFavors.size() > 0;
	}
	
	/**
	 * Initial all strategies as the beginning
	 */
	public void initial(){
		this.numbersEliminates.clear();
		this.numbersFavors.clear();
		this.NumOdd = -1;
		this.NumEven = -1;
		this.isDouble = true;
	}
	
	/* Getter & Setter */
	
	public int getNumOdd() {
		return NumOdd;
	}


	public void setNumOdd(int numOdd) {
		NumOdd = numOdd;
	}


	public int getNumEven() {
		return NumEven;
	}


	public void setNumEven(int numEven) {
		NumEven = numEven;
	}


	public ArrayList<Integer> getNumbersEliminates() {
		return numbersEliminates;
	}


	public void setNumbersEliminates(ArrayList<Integer> numbersEliminates) {
		this.numbersEliminates = numbersEliminates;
	}


	public ArrayList<Integer> getNumbersFavors() {
		return numbersFavors;
	}


	public void setNumbersFavors(ArrayList<Integer> numbersFavors) {
		this.numbersFavors = numbersFavors;
	}


	public boolean isDouble() {
		return isDouble;
	}


	public void setDouble(boolean isDouble) {
		this.isDouble = isDouble;
	}
	
	
	
	
}
